﻿<form id="frm1BXJGWorkOrderWorkOrder" class="frm-container">
    <table class="frm-box">
        <tr>
            <th>处理人</th>
            <td><input name="employeeId" /> </td>
        </tr>
        <tr>
            <th>预计开始时间</th>
            <td><input class="easyui-datetimebox" name="estimatedExecutionTime"></td>
        </tr>
        <tr>
            <th>预计结束时间</th>
            <td><input class="easyui-datetimebox" name="estimatedCompletionTime"></td>
        </tr>
    </table>
</form>
<script>

    (function () {
        const m = 'BXJGWorkOrderWorkOrder';
        const $dlg = $('#dlg1' + m);
        const $frm = $dlg.find('form');
        const ids = $dlg.data('ids');
        const $employeeId = $frm.find('[name="employeeId"]');


        $employeeId.combogrid({
            method: 'GET',
            editable: true,
            mode: 'remote',
            idField: 'id',
            textField: 'name',
            panelWidth: 203,//所有列宽+列数*1px+1px
            delay: 500,
            //pagination: true,
            url: abp.appPath + 'api/services/bxjgworkorder/employee/getall',
            queryParams: { forType: 1 },
            prompt: '==' + abp.localization.bxjgWorkOrder('员工') + '==',
            columns: [[
                { field: 'name', title: '姓名', width: 120 },
                { field: 'phone', title: '电话', width: 120 }
            ]]
        });


        $dlg.data('clickSave', function () {
            //验证录入
            if (!$frm.form('validate'))
                return;

            //处理简单的表单数据
            var postData = $frm.serializeJSON();
            postData.ids = ids;


            let defer = abp.services.bxjgworkorder.workOrder.allocate(postData).done(function (d) {
                abp.notify.success(abp.localization.bxjgWorkOrder('分配') + abp.localization.bxjgUtils('成功') + '!');
                onSaved('onUpdated');
            });
            abp.ui.setBusy($dlg, defer);
        });

        function onSaved(funcName) {
            var f = $dlg.data(funcName);
            if (f)
                f();
        }

        setTimeout(function () {
            $name.next('span').find('input').focus();
        }, 0);

    })();
</script>
